using System;
using System.Collections.Generic;
using System.Linq;

namespace Kiwi.Container.Internal
{
    public static class Throw
    {
        public static void IllegalComponentCast(Type fromType, Type toType)
        {
            throw new IllegalComponentCastException(fromType, toType);
        }

        public static void ComponentNotFound(Type type)
        {
            throw new ComponentNotFoundException(type);
        }

        public static void CircularComponentActivation(IComponentRegistration registration,
                                                       IEnumerable<IComponentRegistration> activated)
        {
            throw new CircularComponentActivationException(registration, activated.Where(a => a != registration));
        }

        public static void AddComponentToCacheFailed(IComponentRegistration registration)
        {
            throw new AddComponentToCacheFailedException(registration);
        }

        public static void ConstructorNotFound(Type type)
        {
            throw new ConstructorNotFoundException(type);
        }

        public static void ActivatedComponentNull(Type serviceType, Type componentType)
        {
            throw new ActivatedComponentNullException(serviceType, componentType);
        }
    }
}